package experiment.e05.code.ch04.v1;

import experiment.e05.code.ch04.v0.Point;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/10/13 16:10
 * @package experiment.e05.code.ch04.v1
 * @description Shape 子类 Circle子类
 */

public class Circle extends Shape {
    // 私有变量
    private double radius;

    // 构造方法
    public Circle() {
    }

    public Circle(double radius) {
        this.radius = radius;
    }

    public Circle(Point point, double radius) {
        super(point);
        this.radius = radius;
    }

    // get && set
    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    /**
     * 获取面积
     *
     * @return
     */
    public double getArea() {
        return Math.PI * radius * radius;
    }

    @Override
    public String toString() {
        return "Circle:{" + "radius=" + radius +", "+ super.toString() + "} ";
    }
}
